<template>
	 <view class="rwgl_xj">
		<view class="rwgl_xj_box" :style="{height:setHeight+'px'}">
			<view class="box1" >
				<!-- <view>
					<uni-section title="巡视对象" type="line"></uni-section>
					<view >
						<uni-collapse :accordion="true" >
								<uni-collapse-item :title="xjObj.targets[0].patrol_target" >
								<view  class="content" >
									<view class="uni-textarea">
										<view class="uni-title uni-common-pl">巡视情况：</view>
										<textarea v-model="xjObj.targets[0].situation" :maxlength="-1" auto-height adjust-position placeholder-style="color:#d9d9d9;font-size:14px"   placeholder="请输入巡视情况"/>
									</view>
									<view class="box2">
										<view class="uni-list">
											 <view class="uni-list-cell-left">
												完成时间：
											</view>
											<view class="uni-list-cell">
												<view class="uni-list-cell-db">
														<picker mode="date"  fields="day" :value="xjObj.targets[0].done_time" :start="startDate" :end="endDate" :custom-item=1 @change="bindDateChange($event,1)" >
																<input class="uni-input" v-model="xjObj.targets[0].done_time" confirm-type="done" disabled  placeholder-style="color:#d9d9d9;font-size:14px" placeholder="请选择" />
														</picker>
												</view>
											</view>
										</view>
										<view class="uni-list">
											 <view class="uni-list-cell-left">
												状态：
											</view>
											<view class="uni-list-cell" @click="cilckZt(0,!xjObj.targets[0].status)">
												<view class="uni-list-cell-db" :class="xjObj.targets[0].status == '1'?'acitv':''">{{xjObj.targets[0].status == '1'?'已完成':'未完成'}}</view>
											</view>
										</view>
									</view>
									<view class="uni-list sctp">
										 <view class="uni-list-cell-left">
											上传图片：
										</view>
										<view class="uni-list-cell">
											<view class="uni-list-cell-db">
												<image mode="aspectFit" src='../../static/img/morenimg.png'  @click="openChooseImage(0)"></image>
												<view class="tpbox"  v-for="(item1,index1) in xjObj.targets[0].img">
													<uni-icons class="icons" type="minus-filled" color="red" size="25" @click="scimg(0,index1)"></uni-icons>
													<image mode="aspectFit" :src='item1' @click="previewImg(0,index1)">
													</image>
												</view>
											</view>
										</view>
									</view>
								</view>
							</uni-collapse-item>
							<uni-collapse-item title="处理意见" :show-animation="true">
								<view  class="content yibz">
									<textarea  v-model="xjObj.deal_advise"  :maxlength="-1"  adjust-position placeholder-style="color:#d9d9d9;font-size:14px"   placeholder="请输入"/>
								</view>
							</uni-collapse-item>
							<uni-collapse-item title="备注" :show-animation="true">
								<view  class="content yibz">
									<textarea  v-model="xjObj.remarks"  :maxlength="-1"  adjust-position placeholder-style="color:#d9d9d9;font-size:14px"   placeholder="请输入"/>
								</view>
							</uni-collapse-item>
						</uni-collapse>
					</view>
				</view> -->
			
				<view class="box box1">
					<view>
						<uni-section title="巡视信息" type="line"></uni-section>
						<view >
							<t-table>
								<t-tr>
									<t-td>
										<view class="uni-list">
											 <view class="uni-list-cell-left">
													线路名称：
												</view>
											<view class="uni-list-cell cell1">
												<input class="uni-input" v-model="xsdxObj.XSXLXX" confirm-type="done" disabled/>
											</view>
										</view>
									</t-td>
								</t-tr>
								<t-tr>
									<t-td>
										<view class="uni-list" @tap="toggleTab(1)" v-if="isdisabled == 0">
											 <view class="uni-list-cell-left">
													巡视开始时间：
												</view>
											<view class="uni-list-cell cell1">
												<!-- <input class="uni-input" v-model="xsdxObj.XSKSSJ" confirm-type="done"  /> -->
												<!-- <picker mode="date"  fields="day" :value="xsdxObj.XSKSSJ" :start="startDate" :end="endDate" :custom-item=1 @change="bindDateChange($event,1)" >
														<input class="uni-input" v-model="xsdxObj.XSKSSJ" confirm-type="done" disabled  placeholder-style="color:#d9d9d9;font-size:14px" placeholder="请选择" />
												</picker> -->
													<input class="uni-input" v-model="xsdxObj.XSKSSJ" confirm-type="done" disabled  placeholder-style="color:#d9d9d9;font-size:14px" placeholder="请选择" />
											</view>
										</view>
									</t-td>
								</t-tr>
								<t-tr>
									<t-td>
										<view class="uni-list" @tap="toggleTab(2)" v-if="isdisabled == 0">
											 <view class="uni-list-cell-left">
													巡视结束时间：
												</view>
											<view class="uni-list-cell cell1">
												<!-- <input class="uni-input" v-model="xsdxObj.XSJSSJ" confirm-type="done"  /> -->
												<!-- <picker mode="date"  fields="day" :value="xsdxObj.XSJSSJ" :start="startDate" :end="endDate" :custom-item=1 @change="bindDateChange($event)" >
														<input class="uni-input" v-model="xsdxObj.XSJSSJ" confirm-type="done" disabled  placeholder-style="color:#d9d9d9;font-size:14px" placeholder="请选择" />
												</picker> -->
												<input class="uni-input" v-model="xsdxObj.XSJSSJ" confirm-type="done" disabled  placeholder-style="color:#d9d9d9;font-size:14px" placeholder="请选择" />
											</view>
										</view>
									</t-td>
								</t-tr>
								<!-- <t-tr>
									<t-td>
										<view class="uni-list">
											 <view class="uni-list-cell-left">
													巡视班组：
												</view>
											<view class="uni-list-cell cell1">
												<input class="uni-input" v-model="xsdxObj.XSRY" confirm-type="done"  />
											</view>
										</view>
									</t-td>
								</t-tr> -->
								<t-tr>
									<t-td>
										<view class="uni-list" @click="toOpen(1)" v-if="isdisabled == 0">
											 <view class="uni-list-cell-left">
													巡视负责人：
												</view>
											<view class="uni-list-cell cell1">
												<input class="uni-input" v-model="xsdxObj.xsfzrs" confirm-type="done"  disabled/>
											</view>
										</view>
									</t-td>
								</t-tr>
								<t-tr>
									<t-td>
										<view class="uni-list" @click="toOpen(2)" v-if="isdisabled == 0">
											 <view class="uni-list-cell-left" >
													巡视成员：
												</view>
											<view class="uni-list-cell cell1">
												<input class="uni-input" v-model="xsdxObj.xscys" confirm-type="done" disabled />
											</view>
										</view>
									</t-td>
								</t-tr>
								<t-tr>
									<t-td>
										<view class="uni-list" @click="openPopup(0)" v-if="isdisabled == 0">
											 <view class="uni-list-cell-left">
													道路是否施工：
											</view>
											<view class="uni-list-cell cell1">
													<input class="uni-input" disabled v-model="xsdxObj.isroadcheck" confirm-type="done"  />
											</view>
										</view>
									</t-td>
								</t-tr>
								<uni-section title="设备信息" type="line"></uni-section>
								<t-tr>
									<t-td>
										<view class="uni-list">
											 <view class="uni-list-cell-left">
													检测设备：
												</view>
											<view class="uni-list-cell cell1">
												<input class="uni-input" v-model="xsdxObj.testequipment" confirm-type="done"  />
											</view>
										</view>
									</t-td>
								</t-tr>
								<t-tr>
									<t-td>
										<view class="uni-list">
											 <view class="uni-list-cell-left">
													温度(℃)：
												</view>
											<view class="uni-list-cell cell1">
												<input class="uni-input" v-model="xsdxObj.temperature" confirm-type="done"  />
											</view>
										</view>
									</t-td>
								</t-tr>
								<view class="jdhl">
									<uni-section title="接地环流" type="line"></uni-section>
									<t-tr>
										<t-td>
											<view class="uni-list">
												 <view class="uni-list-cell-left">
														A相：
													</view>
												<view class="uni-list-cell cell1">
													<input class="uni-input" v-model="xsdxObj.gcca" confirm-type="done"  />
												</view>
												（A）
											</view>
										</t-td>
										<t-td>
											<view class="uni-list">
												 <view class="uni-list-cell-left">
														B相：
												</view>
												<view class="uni-list-cell cell1">
													<input class="uni-input" v-model="xsdxObj.gccb" confirm-type="done"  />
												</view>
												（A）
											</view>
										</t-td>
									</t-tr>
									<t-tr>
										<t-td>
											<view class="uni-list">
												 <view class="uni-list-cell-left">
														C相：
													</view>
												<view class="uni-list-cell cell1">
													<input class="uni-input" v-model="xsdxObj.gccc" confirm-type="done"  />
												</view>
												（A）
											</view>
										</t-td>
										<t-td>
											<view class="uni-list">
												 <view class="uni-list-cell-left">
														E相：
												</view>
												<view class="uni-list-cell cell1">
													<input class="uni-input" v-model="xsdxObj.gcce" confirm-type="done"  />
												</view>
												（A）
											</view>
										</t-td>
									</t-tr>
								</view>
								<view class="blqjc">
									<uni-section title="避雷器检测" type="line"></uni-section>
									<t-tr>
										<t-td>
											<view class="uni-list">
												 <view class="uni-list-cell-left">
														全电流Ix：
													</view>
												<view class="uni-list-cell cell1">
													<input class="uni-input" v-model="xsdxObj.lpaix" confirm-type="done"  />
												</view>
												（A）
											</view>
										</t-td>
									</t-tr>
									<t-tr>
										<t-td>
											<view class="uni-list">
												 <view class="uni-list-cell-left">
														阳性电流Irp：
												</view>
												<view class="uni-list-cell cell1">
													<input class="uni-input" v-model="xsdxObj.lpairp" confirm-type="done"  />
												</view>
												（A）
											</view>
										</t-td>
									</t-tr>
									<t-tr>
										<t-td>
											<view class="uni-list">
												 <view class="uni-list-cell-left">
														容性电流Icp：
												</view>
												<view class="uni-list-cell cell1">
													<input class="uni-input" v-model="xsdxObj.lpaicp" confirm-type="done"  />
												</view>
												（A）
											</view>
										</t-td>
									</t-tr>
								</view>
								<t-tr>
									<t-td>
										<view class="uni-list uni-list1">
											 <view class="uni-list-cell-left">
													备注：
											</view>
											<view class="content yibz">
												<textarea  v-model="xsdxObj.remark"  :maxlength="-1"  adjust-position placeholder-style="color:#d9d9d9;font-size:14px" />
											</view>
										</view>
									</t-td>
								</t-tr>
								<t-tr>
									<t-td>
										<view class="uni-list uni-list1">
											 <view class="uni-list-cell-left">
													上传图像：
											</view>
											<view class="content yibz">
												<view class="uni-list-cell-db">
													<image mode="aspectFit" src='../../static/img/morenimg.png'  @click="openChooseImage2(0)"></image>
													<view class="tpbox"  v-for="(item1,index1) in xjObj.targets[0].img">
														<uni-icons class="icons" type="minus-filled" color="red" size="25" @click="scimg(0,index1)"></uni-icons>
														<image mode="aspectFit" :src='item1' @click="previewImg(0,index1)">
														</image>
													</view>
												</view>
											</view>
										</view>
									</t-td>
								</t-tr>
								<t-tr>
									<t-td>
										<view class="uni-list uni-list1">
											 <view class="uni-list-cell-left">
													文本描述：
											</view>
											<view class="content yibz">
												<textarea  v-model="xsdxObj.WBMS"  :maxlength="-1"  adjust-position placeholder-style="color:#d9d9d9;font-size:14px" />
											</view>
										</view>
									</t-td>
								</t-tr>
							</t-table>
						</view>
					</view>
				</view>
			
			</view>
		</view>
		<view class="btn">
			<text size="mini" class="qrsc" @click="bc()">保存</text>
			<!-- <text size="mini" class="qrsc sc" @click="qrscFn(1)">上传</text> -->
		</view>
		<uni-popup ref="popup" type="bottom">
			<view  class="popup">
				<uni-list class="xqPopup">
					<uni-list-item class="popup_list-item" v-for="(item, index) in weekList" :key="index" :title="item" clickable   @click="xqjOpen(item)"></uni-list-item>
				</uni-list>
			</view>
		</uni-popup>
		<view>
			<jpSelect ref="jpSelect" :list="weekList" @checked="checked"  select="more" tite="请选择"></jpSelect>
			<yu-datetime-picker
			    ref="dateTime"
			    startYear="2010"
			    :isAll="true"
			    :current="true"
			    @confirm="onConfirm">
				</yu-datetime-picker>
		</view>
	</view>
</template>

<script>
	import tTable from '@/components/t-table/t-table.vue';
	import tTh from '@/components/t-table/t-th.vue';
	import tTr from '@/components/t-table/t-tr.vue';
	import tTd from '@/components/t-table/t-td.vue';
	import uniPopup from '@/components/uni-popup/uni-popup.vue';
	import multipleSelect from "@/components/momo-multipleSelect/momo-multipleSelect.vue";//多选
	import jpSelect from '@/components/jp-select/jp-select.vue';
	import uniList from '@/components/uni-list/uni-list.vue'
	import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
	import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
	import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
	import uniIcons from "@/components/uni-icons/uni-icons.vue"
	import yuDatetimePicker from "@/components/yu-datetime-picker/yu-datetime-picker.vue"//日期加时间
	import { pathToBase64 } from '../../js_sdk/gsq-image-tools/image-tools/index.js'
	import { mapState } from 'vuex'
	export default {
	    data() {
			const currentDate = this.getDate({
				format: true
			})
	        return {
				xsdxObj:{
					XSXLXX:"",
					XSKSSJ:"",
					XSJSSJ:"",
					XSRY:"",
					xsfzrs:"",
					xsfzrIDs:"",
					xscys:"",
					xscyIDs:"",
					isroadcheck:"",
					testequipment:"",
					temperature:"",
					gcca:"",
					gccb:"",
					gccc:"",
					gcce:"",
					lpaix:"",
					lpairp:"",
					lpaicp:"",
					remark:"",
					WBMS:"",
				},
				xsrwid:"",
				ryList:[],
				ryLists:[],
				onConfirmindex:"",
				
				data:"",
				xjObjid:"",
				xjObjname:"",
				weekListIdex:'',
				xmid:'',
				setHeight:0,
				weekList:[],
				canvasWidth:'',
				canvasHeight:'',
				xqjLst: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
				tqList:['晴天','多云','雨','雪'],
				sfList:['是','否'],
				xslxLis:['周期性巡视','风险预警特巡','保电特巡'],
				lnimg:[],
				files:[],
				filelist:[],
				isdisabled:0,
				xjObj:{
					task_id:'',
					task_date: currentDate,
					xqj:'',
					task_week:'',
					tq:'',
					patrol_type:'',
					line_name:'',
					audit_status:0,
					qszdz:'',
					deal_advise:'',
					remarks:"",
					targets:[
						{
							task_id:'',
							patrol_target:'',
							patrol_target_id:'',
							done_time:'',
							situation:'',
							status:0,
							files:[],
							img:[]
						}
					]
				}
				
			}
		},
		components: {
			tTable,
            tTh,
            tTr,
            tTd,
			uniPopup,
			multipleSelect,
			jpSelect,
			uniList,
			uniListItem,
			uniCollapse,
			uniCollapseItem,
			uniIcons,
			yuDatetimePicker
		},
		onLoad(options) {
			// console.log(JSON.parse(options.data));
			// var data = JSON.parse(options.data);
			// this.xmid = data.XSRWID;
			// this.xjObj.line_name = data.XLMC;
			// this.xjObj.task_id = data.XSRWID;
			// this.xjObj.patrol_type = data.XSLX;
		},
		mounted(){
			var _this = this
			uni.getSystemInfo({
			  success: function (res) {
				_this.setHeight = res.windowHeight-80;
			  }
			})
			this.queryStaff();
			this.fieldwork();
			this.PatrolList();
		},
		computed: {
			...mapState(['user']),
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			}
		},
		methods:{
			onConfirm(e){
				console.log(e)
				if(this.onConfirmindex == 1){
					this.xsdxObj.XSKSSJ = e.selectRes
				}else if(this.onConfirmindex == 2){
					this.xsdxObj.XSJSSJ = e.selectRes
				}
			},
			toggleTab(i){
				// if(this.isdisabled == 1){
					
				// }else{
					// console.log(i)
					this.onConfirmindex = i
					this.$refs.dateTime.show();  
				// }
				
			},
			
			fieldwork(){
				// console.log(this.$mp.page.options)
				// let a=JSON.parse(this.$mp.page.options)
				
				this.xsrwid = this.$mp.page.options.xsrwid
				this.xsdxObj.XSXLXX = this.$mp.page.options.xlmc
			},
			//选择
			openPopup(a){
				this.weekListIdex = a;
				if(a==0){
					this.weekList = this.sfList;
					
				}else if(a==1){
						this.weekList = this.ryList;
					
					console.log(this.ryList)
				}else if(a==2){
					this.weekList = this.xslxLis;
				}
				this.$refs.popup.open();
			},
			xqjOpen(a){
				let _this=this
				this.$refs.popup.close();
				if(this.weekListIdex==0){
					this.xsdxObj.isroadcheck = a;
				}else if(this.weekListIdex==1){
					this.xsdxObj.xsfzrs = a;
					console.log("_this.ryLists[i].key",this.ryLists.length)
					
					
				}else if(this.weekListIdex==2){
					this.xjObj.patrol_type=a;
				}
			},
			//多选
			checked(el) {
				
				// for(let i=0;i<el.length;i++){
				// 	el[i].value
				// }
				var _this=this
				var fxr = "";
				var key = "";
				el.forEach(function (ele, index) {
					fxr += ele;
					
					for(let i=0;i<_this.ryLists.length;i++){
						if(ele == _this.ryLists[i].value){
							key += _this.ryLists[i].key
						}
					}
					
					// key += ele.key;
					if (index + 1 !== el.length) {
						fxr += ", ";
						key += ", ";
					}
				})
				console.log(fxr,key)
				if(this.weekListIdex == 1){
					this.xsdxObj.xsfzrs = fxr
					this.xsdxObj.xsfzrIDs = key
				}else if(this.weekListIdex == 2){
					this.xsdxObj.xscys = fxr
					this.xsdxObj.xscyIDs = key
				}
				
			},
			toOpen(a) {
				this.weekListIdex = a;
				if(a==1){
					this.weekList = this.ryList;
				}else if(a==2){
					this.weekList = this.ryList;
				}
				this.$refs.jpSelect.toOpen()
			},
			openChooseImage2(i){
				// debugger
				var _self = this;
				uni.chooseImage({
					 count: 10,
					 sizeType:['copressed'],
					 success(res) {
						 //因为有一张图片， 输出下标[0]， 直接输出地址
						 var imgFiles = res.tempFilePaths//[0]
						 console.log(imgFiles)
						 imgFiles.forEach(item => {
						 	_self.xjObj.targets[0].img.push(item);
							
							})
						 // _self.xjObj.targets[i].img.push(imgFiles)
						 console.log(_self.xjObj.targets[0].img)
						 
						_self.filelist = [];
						for(var i = 0 ; i < _self.xjObj.targets[0].img.length ; i ++){
						var obj = {};
						obj.name = "myImages" + i;
						obj.uri = _self.xjObj.targets[0].img[i];
						// filelist.push({name:'afile='+i,uri:self.src[i]})
						_self.filelist.push(obj)
						}
						 
						 // 上传图片
						 // 做成一个上传对象
						 // myImages0
						 // myImages0
						 console.log(_self.$api.url2+'/gydl-patrol/patrolTask/entryResult') 
						// uni.uploadFile({
						// 	 // 需要上传的地址
						// 	 // url:'http://169.254.74.40:8088/gydl-patrol/patrolTask/entryResult',
						// 	 url:_self.$api.url2+'/gydl-patrol/patrolTask/entryResult',
						// 	 // filePath  需要上传的文件
						// 	 // filePath: imgFiles,
						// 	 // name: 'file',
						// 	 files:filelist,
						// 	 formData: {
						// 		 'patrolTaskId': _self.xsrwid,
						// 		 'xsrwStartDate': _self.xsdxObj.XSKSSJ,
						// 		 'xsrwEndDate': _self.xsdxObj.XSJSSJ,
						// 		 'myImagesDesc': _self.xsdxObj.WBMS,
						// 		 'xsjlb': "",
						// 		 'isroadcheck': _self.xsdxObj.isroadcheck,
						// 		 'testequipment': _self.xsdxObj.testequipment,
						// 		 'gcca': _self.xsdxObj.gcca,
						// 		 'gccb': _self.xsdxObj.gccb,
						// 		 'gccc': _self.xsdxObj.gccc,
						// 		 'gcce': _self.xsdxObj.gcce,
						// 		 'temperature': _self.xsdxObj.temperature,
						// 		 'lpaix': _self.xsdxObj.lpaix,
						// 		 'lpairp': _self.xsdxObj.lpairp,
						// 		 'lpaicp': _self.xsdxObj.lpaicp,
						// 		 'remark': _self.xsdxObj.remark,
						// 		 'xsfzrs': _self.xsdxObj.xsfzrs,
						// 		 'xsfzrIDs': _self.xsdxObj.xsfzrIDs,
						// 		 'xscys': _self.xsdxObj.xscys,
						// 		 'xscyIDs': _self.xsdxObj.xscyIDs,
						// 		 "id":"",
						// 	 },
						// 	 success(res1) {
						// 		 // 显示上传信息
						// 		 console.log(res1)
						// 	 },
						// 	 fail(res2){
						// 		 console.log(res2)
						// 	 }
						//  });
						 
						 
						
					 }
				 })
			},
			bc(){
				var _self=this
				console.log("数据",_self.filelist=="")
				if(_self.filelist != ""){
				uni.uploadFile({
					 // 需要上传的地址
					 // url:'http://169.254.74.40:8088/gydl-patrol/patrolTask/entryResult',
					 url:_self.$api.url2+'/gydl-patrol/patrolTask/entryResult',
					 // filePath  需要上传的文件
					 // filePath: imgFiles,
					 // name: 'file',
					 files:_self.filelist,
					 formData: {
						 'patrolTaskId': _self.xsrwid,
						 'xsrwStartDate': _self.xsdxObj.XSKSSJ ,
						 'xsrwEndDate': _self.xsdxObj.XSJSSJ,
						 'myImagesDesc': _self.xsdxObj.WBMS,
						 'xsjlb': "",
						 'isroadcheck': _self.xsdxObj.isroadcheck,
						 'testequipment': _self.xsdxObj.testequipment,
						 'gcca': _self.xsdxObj.gcca,
						 'gccb': _self.xsdxObj.gccb,
						 'gccc': _self.xsdxObj.gccc,
						 'gcce': _self.xsdxObj.gcce,
						 'temperature': _self.xsdxObj.temperature,
						 'lpaix': _self.xsdxObj.lpaix,
						 'lpairp': _self.xsdxObj.lpairp,
						 'lpaicp': _self.xsdxObj.lpaicp,
						 'remark': _self.xsdxObj.remark,
						 'xsfzrs': _self.xsdxObj.xsfzrs,
						 'xsfzrIDs': _self.xsdxObj.xsfzrIDs,
						 'xscys': _self.xsdxObj.xscys,
						 'xscyIDs': _self.xsdxObj.xscyIDs,
						 "id":"",
					 },
					 success(res1) {
						 // 显示上传信息
						 console.log(res1) 
						 if(res1.statusCode == 200){
							uni.showToast({
		 　　　　　　　　　　　　title: '保存成功',
		 　　　　　　　　　　　　icon: 'none'
		 　　　　　　　　　	})
							uni.redirectTo({
								url: './rwgl',
								success: res => {},fail: () => {},complete: () => {}
							});
						}else{
							uni.showToast({
			 　　　　　　　　　　　　title: '保存失败',
			 　　　　　　　　　　　　icon: 'none'
			 　　　　　　　　　	})
						}  
					 },
					 fail(res2){
						 console.log("123333",res2)
						 uni.showToast({
	 　　　　　　　　　　　　title: '请输入数据',
	 　　　　　　　　　　　　icon: 'none'
	 　　　　　　　　　	})
					 }
				 });
				 }else{
					 uni.showToast({
	 　　　　　　　　　　　　title: '请上传图片',
	 　　　　　　　　　　　　icon: 'none'
	 　　　　　　　　　	})
				 }
			},
			openChooseImage(i){
				// debugger
				let _this = this;
				uni.chooseImage({
					// sizeType:'compressed', 
					success: res =>{
						res.tempFiles.forEach(item => {
							_this.xjObj.targets[i].img.push(item.path);
							
							plus.zip.compressImage({
									src:item.path,
									dst:item.path.replace('.png','1.png').replace('.PNG', '1.PNG').replace('.jpg','1.jpg').replace('.JPG','1.JPG'),
									quality:20
								},
								function(event) {
									// _this.lnimg.push(event.target);
									pathToBase64(event.target).then(base64 => {
										// console.log(base64);
										_this.xjObj.targets[i].files.push(base64);
									}).catch(error => {
											console.error(error)
									})
								},function(error) {
									pathToBase64(item.path).then(base64 => {
										_this.xjObj.targets[i].files.push(base64);
									}).catch(error => {
											console.error(error)
									})
									// console.log("Compress error!");
							});
						})
					}
				})
				console.log(_this.xjObj.targets[0].img)
			},
			
			bindDateChange: function(e,i) {
				if(i == undefined){
					var _time = new Date(e.target.value);
					let month = _time.getMonth() + 1;
					let day = _time.getDate();
					// this.xjObj.date = `${month}月${day}日`;
					this.xsdxObj.XSJSSJ =  e.target.value+" 00:00:00";
				}else{
					this.xsdxObj.XSKSSJ = e.target.value+" 00:00:00";
				}
			},
			cilckZt(i,a){
				// console.log(i,a)
				this.xjObj.targets[i].status = a?1:0;
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
	
				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
				// return `${month}月${day}日`;
			},
			//确认上传
			qrscFn(type){
				//obj.targets.length-1
				// this.task_id=this.$mp.page.options.xsrwid
				// this.xqjLst.forEach((item,index) => {
				// 	if(this.xjObj.xqj == item ){
				// 		this.xjObj.task_week = index+1;
				// 		return
				// 	}
				// });
				// let obj = JSON.parse(JSON.stringify(this.xjObj));
				// for(let i=obj.targets.length-1; i>=0; i--){
				//     if(obj.targets[i].done_time == '' && obj.targets[i].files.length == 0 && obj.targets[i].situation == '' && !obj.targets[i].status){
				//         obj.targets.splice(i,1);
				//     }
				// }
				// obj.audit_status = type;
				// // let ajaxT = 'rwglxjsc';
				// if(this.xmid){
				// 	if(type == 1){
				// 		// ajaxT = 'updatePUT';
				// 	}else{
				// 		// ajaxT = 'startPOST';
				// 		obj.create_user_id = this.user.id;
				// 	}
				// }
				// obj.targets[0].task_id = this.$mp.page.options.xsrwid;
				// obj.task_id = this.$mp.page.options.xsrwid;
				// obj.id = this.$mp.page.options.rwid;
				///////////////////////////////////////////////
				
				// JSON.stringify({
				// 			patrolTaskId : "20e3c65035e546f68d5c7e2cdaa08122fc",
				// 			xsrwStartDate: _this.xsdxObj.XSXLXX
				// 		})
				
				var formData = {};
				for (var i = 0; i < this.xjObj.targets[0].img.length; i++) { // 巡视图像
					formData['myImages' + i] = this.xjObj.targets[0].img;
				}
				console.log(formData)
				// formData.append('patrolTaskId', this.xsrwid); //巡检任务标识 
				this.$set(formData, 'patrolTaskId', this.xsrwid);
				this.$set(formData, 'xsrwStartDate', this.xsdxObj.XSKSSJ);
				this.$set(formData, 'xsrwEndDate', this.xsdxObj.XSJSSJ);
				this.$set(formData, 'myImagesDesc', this.xsdxObj.WBMS);
				this.$set(formData, 'xsjlb', "");
				this.$set(formData, 'isroadcheck', this.xsdxObj.isroadcheck);
				this.$set(formData, 'testequipment', this.xsdxObj.testequipment);
				this.$set(formData, 'gcca', this.xsdxObj.gcca);
				this.$set(formData, 'gccb', this.xsdxObj.gccb);
				this.$set(formData, 'gccc', this.xsdxObj.gccc);
				this.$set(formData, 'gcce', this.xsdxObj.gcce);
				this.$set(formData, 'temperature', this.xsdxObj.temperature);
				this.$set(formData, 'lpaix', this.xsdxObj.lpaix);
				this.$set(formData, 'lpairp', this.xsdxObj.lpairp);
				this.$set(formData, 'lpaicp', this.xsdxObj.lpaicp);
				this.$set(formData, 'remark', this.xsdxObj.remark);
				this.$set(formData, 'xsfzrs', this.xsdxObj.xsfzrs);
				this.$set(formData, 'xsfzrIDs', this.xsdxObj.xsfzrIDs);
				this.$set(formData, 'xscys', this.xsdxObj.xscys);
				this.$set(formData, 'xscyIDs', this.xsdxObj.xscyIDs);
				this.$set(formData, 'id', "");
				
				this.$api.taskSavePOST(formData).then(res => {
					console.log("res",res)
					// 获得数据 
					if(res.code == 200){
						// uni.navigateTo({
						// 	url: '../index/index',
						// });
					}else{
						uni.showToast({
		　　　　　　　　　　　　title: '请求失败',
		　　　　　　　　　　　　icon: 'none'
		　　　　　　　　　	})
					}
				 })
			},
			//获得巡视人员
			queryStaff(){
				this.$api.staffPOST({id:""}).then(res => {
							
							let _this=this
							// 获得数据 
							if(res.resultCode == 200){
								 
								res.data.forEach((item,index) => {
									_this.ryList.push(
										item.realname
									)
									_this.ryLists.push({
										key:item.id,
										value:item.realname
									});
									// _this.ryList=item
								});
								
							}else{
								uni.showToast({
				　　　　　　　　　　　　title: '请求失败',
				　　　　　　　　　　　　icon: 'none'
				　　　　　　　　　	})
							}
						 })
			},
			//获得巡视结果
			PatrolList(){
				let _this=this
				this.$api.PatrolList(`gydl-patrol/patrolTask/PatrolList?rwjgbs=${this.xsrwid}`)
				.then(res => {
					console.log(res)
					if(res.data.length != 0){
						
						_this.isdisabled = "1"
					}
					console.log("进",_this.isdisabled)
				 })
			},
			getBase64(imgUrl,callback) {
			  window.URL = window.URL || window.webkitURL;
			  var xhr = new XMLHttpRequest();
			  xhr.open("get", imgUrl, true);
			  // 至关重要
			  xhr.responseType = "blob";
			  xhr.onload = function () {
			    if (this.status == 200) {
			      //得到一个blob对象
			      var blob = this.response;
			      // 至关重要
			      let oFileReader = new FileReader();
			      oFileReader.onloadend = function (e) {
			        // 此处拿到的已经是 base64的图片了
			        let base64 = e.target.result;
			        callback(base64)
			      };
			      oFileReader.readAsDataURL(blob);
			    }
			  }
			  xhr.send();
			},
			// 预览图片多张
			previewImg(i,n) {
				uni.previewImage({
					current: n,
					urls: this.xjObj.targets[i].img,
				});

			},
			scimg(i,n){
				this.xjObj.targets[i].img.splice(n,1);
				this.xjObj.targets[i].files.splice(n,1);
			}
		}
	}
</script>
<style lang="less" scoped>
	page{
		background-color: #eff3f6;
	}

			.tpbox{
				display: inline-block;
				position: relative;
				.icons{
					position: absolute;
					top: -10rpx;
					right: 0px;
					z-index: 1;
				}
			}
			uni-image{
				width: 130rpx; 
				height: 130rpx;
				margin-right: 20rpx;
			}
		
	
	.rwgl_xj{
		.rwgl_xj_box{
			padding: 30rpx;
			background-color: #eff3f6;
			background-image: url(../../static/img/rwxj_bj.png);
			background-position: top;
			background-repeat: no-repeat;
			background-size: 100% 300rpx;
			overflow: hidden;
			overflow-y: auto;
		}
		/deep/.uni-input-input{
			font-size: 28rpx;
		}
		.box{
			margin-top: 140rpx;
			background-color: #FFFFFF;
			border-radius: 30rpx;
			overflow: hidden;
			margin-bottom: 30rpx;
			padding: 20rpx;
			padding-right: 10rpx;
			color:#000;
			.t-table,.t-td{
				border-width:0px !important;
			}
			.t-td{
				padding: 10rpx 0;
				.uni-list-cell-left{
					padding: 0;
				}
			}
		}
		.image-list{
			display: flex;
			flex-wrap: wrap;
			.image-content{
				width: 33.33333%;
				height: 200rpx;
				box-sizing: border-box;
				padding:0 10rpx;
				padding-bottom: 20rpx;
			}
		}
		.t-table .t-tr:nth-child(2n){
			background-color: #fff;
		}
		.uni-list{
			position: relative;
			width: 100%;
			display: flex;
			flex-direction: inherit;
			flex-wrap: wrap;
			padding: 10rpx 0;
			line-height:48rpx;
			.uni-list-cell-left {
				width: 240rpx;
			    white-space: nowrap;
			    font-size: 28rpx;
			    padding: 0 30rpx;
			}
			.uni-list-cell{
				border:2rpx solid #eff3f6;
				width: calc(100% - 130px);
				border-radius:10rpx;
				text-shadow: inherit;
				font-size: 28rpx;
			}
			.uni-list-cell-db, .uni-list-cell-right {
			    flex: 1;
			}
		}
		.btn{
			.qrsc{
				display: inline-block;
				width: 100%;
				line-height: 100rpx;
				text-align: center;
				color: #007AFF;
			}
			.sc{
				border-left: 2rpx solid #f0f0f0;
				box-sizing: border-box;
			}
		}
		.box1{
			margin-top: 0px;
			background-color: #FFFFFF;
			border-radius: 30rpx;
			overflow: hidden;
			color:#000;
			.uni-section{
				background-color:#fff;
				margin: 0;
				/deep/.line{
					background-color: #4d8bfd;
				}
				/deep/.uni-section__content-title{
					font-size: 32rpx;
				}
			}
			.uni-collapse-cell--open,.uni-collapse-cell{
				background-color: #fff;
			}
			/deep/.uni-collapse-cell__title-arrow{
				color: #4d8bfd !important;
			}
			.content{
				padding: 0px 30rpx;
				font-size: 28rpx;
				line-height: 40rpx;
				background-color: #fff;
				color: #666;
			}
			.uni-textarea{
				padding: 10rpx;
				background-color: #fff;
				display: flex;
				line-height: 50rpx;
			}
			
			uni-textarea{
				width: calc(100% - 70px);
				border:2rpx solid #eff3f6;
				border-radius:10rpx;
				font-size: 28rpx;
				box-sizing: border-box;
				padding-left: 10rpx;
				line-height: 50rpx;
			}
			.uni-list{
				padding: 10rpx;
				background-color: #fff;
				height: 60rpx;
				line-height: 60rpx;
				.uni-list-cell-left{
					padding: 0;
				}
			}
			.jdhl{
				.uni-list .uni-list-cell-left{
					width: 100rpx;
				}
				.uni-list .uni-list-cell{
					width: calc(100% - 95px);
				}
			}
			.blqjc{
				.uni-list .uni-list-cell-left{
					width: 180rpx;
				}
				.uni-list .uni-list-cell{
					width: calc(100% - 135px);
				}
			}
			.content{
				padding: 0px 30rpx;
				font-size: 28rpx;
				line-height: 40rpx;
				background-color: #fff;
				color: #666;
			}
			.yibz{
				padding-bottom:30rpx ;
				uni-textarea{
					width: 100%;
					height: 140rpx !important;
				}
			}
			.uni-list1{
				height: auto;
				.uni-list-cell-left{
					width:130rpx;
				}
				.yibz{
					width: calc(100% - 95px);
				}
			}
		}
		.popup{
			max-height: 566rpx;
			overflow-y: auto;
			.xqPopup{
				background-color: #fff;
				flex-direction: column;
					.popup_list-item{
						text-align: center;	
				}
			}
		}
	}
</style>
<!-- <style lang="scss" scoped>
	.rwgl_xj{
		.rwgl_xj_box{
			padding: 30rpx;
			background-color: #0e2b5c;
			background-image: url(../../static/img/rwxj_bj.png);
			background-position: top;
			background-repeat: no-repeat;
			background-size: 100% 150px;
			overflow: hidden;
			overflow-y: auto;
		}
		/deep/.uni-input-input{
			font-size: 14px;
		}
		.box{
			margin-top: 70px;
			background-color: #FFFFFF;
			border-radius: 30rpx;
			overflow: hidden;
			margin-bottom: 30rpx;
			padding: 10px;
			padding-right: 5px;
			color:#000;
			.t-table,.t-td{
				border-width:0px !important;
			}
			.t-td{
				padding: 5px 0;
				.uni-list-cell-left{
					padding: 0;
				}
			}
		}
		.image-list{
			display: flex;
			flex-wrap: wrap;
			.image-content{
				width: 33.33333%;
				height: 100px;
				box-sizing: border-box;
				padding:0 5px;
				padding-bottom: 10px;
			}
		}
		.t-table .t-tr:nth-child(2n){
			background-color: #fff;
		}
		.uni-list{
			position: relative;
			width: 100%;
			display: flex;
			flex-direction: inherit;
			flex-wrap: wrap;
			padding: 5px 0;
			line-height:24px;
			.uni-list-cell-left {
			    white-space: nowrap;
			    font-size: 14px;
			    padding: 0 30rpx;
			}
			.uni-list-cell{
				border:1px solid #eff3f6;
				width: calc(100% - 75px);
				border-radius:5px;
				text-shadow: inherit;
				font-size: 14px;
			}
			.uni-list-cell.cell{
				width: calc(100% - 75px);
			}
			.uni-list-cell.cell1{
				width: calc(100% - 90px);
			}
			.uni-list-cell-db, .uni-list-cell-right {
			    flex: 1;
				
			}
		}
		.box1{
			background-color: #FFFFFF;
			border-radius: 30rpx;
			overflow: hidden;
			color:#000;
			.uni-section{
				background-color:#fff;
				margin: 0;
				/deep/.line{
					background-color: #4d8bfd;
				}
				/deep/.uni-section__content-title{
					font-size: 16px;
				}
			}
			.uni-collapse-cell--open,.uni-collapse-cell{
				background-color: #fff;
			}
			/deep/.uni-collapse-cell__title-arrow{
				color: #4d8bfd !important;
			}
			.content{
				padding: 0px 30rpx;
				font-size: 14px;
				line-height: 20px;
				background-color: #fff;
				color: #666;
			}
			.uni-textarea{
				padding: 5px;
				background-color: #fff;
				display: flex;
				line-height: 25px;
			}
			
			uni-textarea{
				width: calc(100% - 70px);
				border:1px solid #eff3f6;
				border-radius:5px;
				font-size: 14px;
				box-sizing: border-box;
				padding-left: 5px;
				line-height: 25px;
			}
			.uni-list{
				padding: 5px;
				background-color: #fff;
				height: 30px;
				line-height: 30px;
				.uni-list-cell-left{
					padding: 0;
				}
			}
			.box2{
				display: flex;
				padding: 5px;
				.uni-list{
					flex:2;
					padding: 0;
				}
				.uni-list:nth-child(1){
					.uni-list-cell{
						padding-top: 3px;
						padding-left: 5px;
						box-sizing: border-box;
					}
				}
				.uni-list:nth-child(2){
					flex:1;
					.uni-list-cell{
						width: calc(100% - 45px);
						text-align: center;
						.uni-list-cell-db{
							background-color: #999;
							color: #fff;
							border-radius: 5px;
						}
						.uni-list-cell-db.acitv{
							background-color: #4d8bfd;
						}
					}
				}
			}
			.sctp{
				height:auto;
				.uni-list-cell{
					border:none;
					.tpbox{
						display: inline-block;
						position: relative;
						.icons{
							position: absolute;
							top: -5px;
							right: 0px;
							z-index: 1;
						}
					}
					uni-image{
						width: 65px; 
						height: 65px;
						margin-right: 10px;
					}
				}
			}
			.yibz{
				padding-bottom:30rpx ;
				uni-textarea{
					width: 100%;
					height: 70px !important;
				}
			}
		}
		.btn{
			.qrsc{
				display: inline-block;
				width: 50%;
				line-height: 50px;
				text-align: center;
				color: #007AFF;
			}
			.sc{
				border-left: 1px solid #f0f0f0;
				box-sizing: border-box;
			}
		}
		.popup{
			max-height: 283px;
			overflow-y: auto;
			.xqPopup{
				background-color: #fff;
				flex-direction: column;
					.popup_list-item{
						text-align: center;	
				}
			}
		}
	}
</style> -->
